package com.cq.hd.product.controller;

import com.cq.hd.common.pagination.Page;
import com.cq.hd.common.response.Result;
import com.cq.hd.common.response.ResultGenerator;
import com.cq.hd.product.api.TbActiveCollectApi;
import com.cq.hd.product.api.dto.ActiveCollectPageDto;
import com.cq.hd.product.api.dto.ActiveCollectUpdateDto;
import com.cq.hd.product.api.vo.ActiveCollectPageVo;
import com.cq.hd.product.service.TbActiveCollectService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 活动收藏记录表 前端控制器
 * </p>
 *
 * @author mYunYu
 * @since 2023-12-01
 */
@RestController
public class TbActiveCollectController implements TbActiveCollectApi {

    @Autowired
    private TbActiveCollectService activeCollectService;

    @ApiOperation(value = "活动收藏/取消收藏")
    @ApiImplicitParam(name = "activeCollectUpdateDto", value = "实体", paramType = "body", dataType = "ActiveCollectUpdateDto")
    @Override
    public Result<Object> updateState(@RequestBody ActiveCollectUpdateDto activeCollectUpdateDto) {
        return ResultGenerator.success(activeCollectService.updateState(activeCollectUpdateDto));
    }

    @ApiOperation(value = "收藏活动列表")
    @ApiImplicitParam(name = "activeCollectPageDto", value = "实体", paramType = "query", dataType = "ActiveCollectPageDto")
    @ApiResponse(response = ActiveCollectPageVo.class, code = 200, message = "接口返回对象参数")
    @Override
    public Result<Page<ActiveCollectPageVo>> page(ActiveCollectPageDto activeCollectPageDto) {
        return ResultGenerator.success(activeCollectService.pageActiveCollect(activeCollectPageDto));
    }
}
